using APP.HELPER.Data.Helper;
using APP.HELPER.Utils.Security;
using System;
using System.Data;
using System.Data.SqlClient;
namespace Extra.ERP
{
	public class SYS_INFO
	{
		private string m_SysInfo_ID;
		private string m_Application;
		private string m_Version;
		private int m_Type;
		private DateTime m_Created;
		private string m_Description;
		private static string m_Guid_ID;
		private static long _count = -1L;
		public string SysInfo_ID
		{
			get
			{
				return this.m_SysInfo_ID;
			}
			set
			{
				this.m_SysInfo_ID = value;
			}
		}
		public string Application
		{
			get
			{
				return this.m_Application;
			}
			set
			{
				this.m_Application = value;
			}
		}
		public string Version
		{
			get
			{
				return this.m_Version;
			}
			set
			{
				this.m_Version = value;
			}
		}
		public int Type
		{
			get
			{
				return this.m_Type;
			}
			set
			{
				this.m_Type = value;
			}
		}
		public DateTime Created
		{
			get
			{
				return this.m_Created;
			}
			set
			{
				this.m_Created = value;
			}
		}
		public string Description
		{
			get
			{
				return this.m_Description;
			}
			set
			{
				this.m_Description = value;
			}
		}
		public static string Guid_ID
		{
			get
			{
				return SYS_INFO.m_Guid_ID;
			}
			set
			{
				SYS_INFO.m_Guid_ID = value;
			}
		}
		public string ProductName
		{
			get
			{
				return "Class SYS_INFO";
			}
		}
		public string ProductVersion
		{
			get
			{
				return "1.0.0.0";
			}
		}
		public static long Count
		{
			get
			{
				SYS_INFO.Cal();
				return SYS_INFO._count;
			}
		}
		public SYS_INFO()
		{
			this.m_SysInfo_ID = "";
			this.m_Application = "";
			this.m_Version = "";
			this.m_Type = 0;
			this.m_Created = DateTime.Now;
			this.m_Description = "";
			SYS_INFO.m_Guid_ID = "";
		}
		public SYS_INFO(string SysInfo_ID, string Application, string Version, int Type, DateTime Created, string Description)
		{
			this.m_SysInfo_ID = SysInfo_ID;
			this.m_Application = Application;
			this.m_Version = Version;
			this.m_Type = Type;
			this.m_Created = Created;
			this.m_Description = Description;
			SYS_INFO.m_Guid_ID = SYS_INFO.Guid_ID;
		}
		public string NewID()
		{
			return SqlHelper.GenCode("SYS_INFO", "SYS_INFOID", "");
		}
		public bool Exist(string SysInfo_ID)
		{
			bool result = false;
			string[] myParams = new string[]
			{
				"@SysInfo_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			SqlDataReader sqlDataReader = sqlHelper.ExecuteReader("SYS_INFO_Get", myParams, myValues);
			if (sqlDataReader != null)
			{
				result = sqlDataReader.HasRows;
				sqlDataReader.Close();
				sqlHelper.Close();
			}
			return result;
		}
		public string Get(string SysInfo_ID)
		{
			string result = "";
			string[] myParams = new string[]
			{
				"@SysInfo_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			SqlDataReader sqlDataReader = sqlHelper.ExecuteReader("SYS_INFO_Get", myParams, myValues);
			if (sqlDataReader != null)
			{
				while (sqlDataReader.Read())
				{
					this.m_SysInfo_ID = Convert.ToString(sqlDataReader["SysInfo_ID"]);
					this.m_Application = Convert.ToString(sqlDataReader["Application"]);
					this.m_Version = Convert.ToString(sqlDataReader["Version"]);
					this.m_Type = Convert.ToInt32(sqlDataReader["Type"]);
					this.m_Created = Convert.ToDateTime(sqlDataReader["Created"]);
					this.m_Description = Convert.ToString(sqlDataReader["Description"]);
					result = "OK";
				}
				sqlDataReader.Close();
				sqlHelper.Close();
			}
			return result;
		}
		public string GetInfo(string database)
		{
			string result = "";
			SqlHelper sqlHelper = new SqlHelper();
			sqlHelper.CommandType = CommandType.Text;
			SqlDataReader sqlDataReader = sqlHelper.ExecuteReader("select * from [" + database + "].dbo.SYS_INFO");
			if (sqlDataReader != null)
			{
				while (sqlDataReader.Read())
				{
					this.m_SysInfo_ID = Convert.ToString(sqlDataReader["SysInfo_ID"]);
					this.m_Application = Convert.ToString(sqlDataReader["Application"]);
					this.m_Version = Convert.ToString(sqlDataReader["Version"]);
					this.m_Type = Convert.ToInt32(sqlDataReader["Type"]);
					this.m_Created = Convert.ToDateTime(sqlDataReader["Created"]);
					this.m_Description = Convert.ToString(sqlDataReader["Description"]);
					result = "OK";
				}
				sqlDataReader.Close();
				sqlDataReader.Dispose();
				sqlHelper.Close();
			}
			return result;
		}
		public string Get()
		{
			string result = "";
			SqlHelper sqlHelper = new SqlHelper();
			sqlHelper.Extract();
			sqlHelper.CommandType = CommandType.Text;
			SqlDataReader sqlDataReader = sqlHelper.ExecuteReader("select * from[" + sqlHelper.Database + "].dbo.SYS_INFO");
			if (sqlDataReader != null)
			{
				while (sqlDataReader.Read())
				{
					this.m_SysInfo_ID = Convert.ToString(sqlDataReader["SysInfo_ID"]);
					this.m_Application = Convert.ToString(sqlDataReader["Application"]);
					this.m_Version = Convert.ToString(sqlDataReader["Version"]);
					this.m_Type = Convert.ToInt32(sqlDataReader["Type"]);
					this.m_Created = Convert.ToDateTime(sqlDataReader["Created"]);
					this.m_Description = Convert.ToString(sqlDataReader["Description"]);
					result = "OK";
				}
				sqlDataReader.Close();
				sqlDataReader.Dispose();
				sqlHelper.Close();
			}
			return result;
		}
		public static string GetInfo()
		{
			string result = "";
			SqlHelper sqlHelper = new SqlHelper();
			sqlHelper.CommandType = CommandType.Text;
			SqlDataReader sqlDataReader = sqlHelper.ExecuteReader("select  Guid_ID from dbo.SYS_INFO");
			if (sqlDataReader != null)
			{
				while (sqlDataReader.Read())
				{
					SYS_INFO.m_Guid_ID = Convert.ToString(sqlDataReader["Guid_ID"]);
					result = "OK";
				}
				sqlDataReader.Close();
				sqlHelper.Close();
			}
			return result;
		}
		private static void Cal()
		{
			SYS_INFO.GetInfo();
			string text = SYS_INFO.m_Guid_ID;
			text = MyEncryption.Decrypt(text, "zxc123", true);
			SYS_INFO._count = Convert.ToInt64(text);
			if (SYS_INFO._count == 0L)
			{
				new SqlHelper
				{
					CommandType = CommandType.Text
				}.ExecuteNonQuery("Update [SYS_INFO] set [Guid_ID]='RYhjrnjcBlI='");
			}
		}
		public string Get(SqlConnection myConnection, string SysInfo_ID)
		{
			string result = "";
			string[] myParams = new string[]
			{
				"@SysInfo_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			SqlDataReader sqlDataReader = sqlHelper.ExecuteReader(myConnection, "SYS_INFO_Get", myParams, myValues);
			if (sqlDataReader != null)
			{
				while (sqlDataReader.Read())
				{
					this.m_SysInfo_ID = Convert.ToString(sqlDataReader["SysInfo_ID"]);
					this.m_Application = Convert.ToString(sqlDataReader["Application"]);
					this.m_Version = Convert.ToString(sqlDataReader["Version"]);
					this.m_Type = Convert.ToInt32(sqlDataReader["Type"]);
					this.m_Created = Convert.ToDateTime(sqlDataReader["Created"]);
					this.m_Description = Convert.ToString(sqlDataReader["Description"]);
					SYS_INFO.m_Guid_ID = Convert.ToString(sqlDataReader["Guid_ID"]);
					result = "OK";
				}
				sqlDataReader.Close();
				sqlHelper.Close();
			}
			return result;
		}
		public string Get(SqlTransaction myTransaction, string SysInfo_ID)
		{
			string result = "";
			string[] myParams = new string[]
			{
				"@SysInfo_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			SqlDataReader sqlDataReader = sqlHelper.ExecuteReader(myTransaction, "SYS_INFO_Get", myParams, myValues);
			if (sqlDataReader != null)
			{
				while (sqlDataReader.Read())
				{
					this.m_SysInfo_ID = Convert.ToString(sqlDataReader["SysInfo_ID"]);
					this.m_Application = Convert.ToString(sqlDataReader["Application"]);
					this.m_Version = Convert.ToString(sqlDataReader["Version"]);
					this.m_Type = Convert.ToInt32(sqlDataReader["Type"]);
					this.m_Created = Convert.ToDateTime(sqlDataReader["Created"]);
					this.m_Description = Convert.ToString(sqlDataReader["Description"]);
					SYS_INFO.m_Guid_ID = Convert.ToString(sqlDataReader["Guid_ID"]);
					result = "OK";
				}
				sqlDataReader.Close();
				sqlHelper.Close();
			}
			return result;
		}
		public string Insert()
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID",
				"@Application",
				"@Version",
				"@Type",
				"@Created",
				"@Description",
				"@Guid_ID"
			};
			object[] myValues = new object[]
			{
				this.m_SysInfo_ID,
				this.m_Application,
				this.m_Version,
				this.m_Type,
				this.m_Created,
				this.m_Description,
				SYS_INFO.m_Guid_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery("SYS_INFO_Insert", myParams, myValues);
		}
		public string Insert(SqlTransaction myTransaction)
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID",
				"@Application",
				"@Version",
				"@Type",
				"@Created",
				"@Description",
				"@Guid_ID"
			};
			object[] myValues = new object[]
			{
				this.m_SysInfo_ID,
				this.m_Application,
				this.m_Version,
				this.m_Type,
				this.m_Created,
				this.m_Description,
				SYS_INFO.m_Guid_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery(myTransaction, "SYS_INFO_Insert", myParams, myValues);
		}
		public string Insert(string SysInfo_ID, string Application, string Version, int Type, DateTime Created, string Description, string Guid_ID)
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID",
				"@Application",
				"@Version",
				"@Type",
				"@Created",
				"@Description",
				"@Guid_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID,
				Application,
				Version,
				Type,
				Created,
				Description,
				Guid_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery("SYS_INFO_Insert", myParams, myValues);
		}
		public string Insert(SqlConnection myConnection, string SysInfo_ID, string Application, string Version, int Type, DateTime Created, string Description, string Guid_ID)
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID",
				"@Application",
				"@Version",
				"@Type",
				"@Created",
				"@Description",
				"@Guid_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID,
				Application,
				Version,
				Type,
				Created,
				Description,
				Guid_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery(myConnection, "SYS_INFO_Insert", myParams, myValues);
		}
		public string Insert(SqlTransaction myTransaction, string SysInfo_ID, string Application, string Version, int Type, DateTime Created, string Description, string Guid_ID)
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID",
				"@Application",
				"@Version",
				"@Type",
				"@Created",
				"@Description",
				"@Guid_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID,
				Application,
				Version,
				Type,
				Created,
				Description,
				Guid_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery(myTransaction, "SYS_INFO_Insert", myParams, myValues);
		}
		public string Update()
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID",
				"@Application",
				"@Version",
				"@Type",
				"@Created",
				"@Description",
				"@Guid_ID"
			};
			object[] myValues = new object[]
			{
				this.m_SysInfo_ID,
				this.m_Application,
				this.m_Version,
				this.m_Type,
				this.m_Created,
				this.m_Description,
				SYS_INFO.m_Guid_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery("SYS_INFO_Update", myParams, myValues);
		}
		public string Update(SqlTransaction myTransaction)
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID",
				"@Application",
				"@Version",
				"@Type",
				"@Created",
				"@Description",
				"@Guid_ID"
			};
			object[] myValues = new object[]
			{
				this.m_SysInfo_ID,
				this.m_Application,
				this.m_Version,
				this.m_Type,
				this.m_Created,
				this.m_Description,
				SYS_INFO.m_Guid_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery(myTransaction, "SYS_INFO_Update", myParams, myValues);
		}
		public string Update(string SysInfo_ID, string Application, string Version, int Type, DateTime Created, string Description, string Guid_ID)
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID",
				"@Application",
				"@Version",
				"@Type",
				"@Created",
				"@Description",
				"@Guid_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID,
				Application,
				Version,
				Type,
				Created,
				Description,
				Guid_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery("SYS_INFO_Update", myParams, myValues);
		}
		public string Update(SqlConnection myConnection, string SysInfo_ID, string Application, string Version, int Type, DateTime Created, string Description, string Guid_ID)
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID",
				"@Application",
				"@Version",
				"@Type",
				"@Created",
				"@Description",
				"@Guid_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID,
				Application,
				Version,
				Type,
				Created,
				Description,
				Guid_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery(myConnection, "SYS_INFO_Update", myParams, myValues);
		}
		public string Update(SqlTransaction myTransaction, string SysInfo_ID, string Application, string Version, int Type, DateTime Created, string Description, string Guid_ID)
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID",
				"@Application",
				"@Version",
				"@Type",
				"@Created",
				"@Description",
				"@Guid_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID,
				Application,
				Version,
				Type,
				Created,
				Description,
				Guid_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery(myTransaction, "SYS_INFO_Update", myParams, myValues);
		}
		public string Delete()
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID"
			};
			object[] myValues = new object[]
			{
				this.m_SysInfo_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery("SYS_INFO_Delete", myParams, myValues);
		}
		public string Delete(string SysInfo_ID)
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery("SYS_INFO_Delete", myParams, myValues);
		}
		public string Delete(SqlConnection myConnection, string SysInfo_ID)
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery(myConnection, "SYS_INFO_Delete", myParams, myValues);
		}
		public string Delete(SqlTransaction myTransaction, string SysInfo_ID)
		{
			string[] myParams = new string[]
			{
				"@SysInfo_ID"
			};
			object[] myValues = new object[]
			{
				SysInfo_ID
			};
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteNonQuery(myTransaction, "SYS_INFO_Delete", myParams, myValues);
		}
		public DataTable GetList()
		{
			SqlHelper sqlHelper = new SqlHelper();
			return sqlHelper.ExecuteDataTable("SYS_INFO_GetList");
		}
	}
}
